package com.uperform.coach.tdd.task;

import com.uperform.coach.tdd.domain.NewTaskService;
import org.springframework.web.bind.annotation.*;

@RestController
public class TaskController {
    private final NewTaskService newTaskService;

    public TaskController(NewTaskService newTaskService) {
        this.newTaskService = newTaskService;
    }

    @PostMapping("/test")
    public void test(@RequestBody NewTaskForm form) {
        newTaskService.execute(form.toRequest());
    }

    @ExceptionHandler(RuntimeException.class)
    public void onException(RuntimeException e) {
        e.printStackTrace();
    }
}
